package ilearn.job.disserver.sdk.account;

import com.fasterxml.jackson.core.JacksonException;
import com.fasterxml.jackson.databind.ObjectMapper;
import ilearn.job.disserver.sdk.account.config.RabbitMQConfigration;
import ilearn.job.disserver.sdk.account.dto.AccountDTO;
import lombok.extern.log4j.Log4j2;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Log4j2
public class RabbitMQSender {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void send(AccountDTO accountDTO)throws JacksonException {
        rabbitTemplate.convertAndSend(RabbitMQConfigration.TopicExchangeName,
                RabbitMQConfigration.RouteKey,accountDTO);
    }

}
